package com.xncoding.aop.controller;

import com.fasterxml.jackson.annotation.JsonView;
import com.xncoding.aop.model.User;
import com.xncoding.aop.model.UserView;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/jsonview")
public class JsonViewController {

    @GetMapping("/user/basic")
    @JsonView(UserView.Basic.class)
    public User userWithout() {
        User user = new User(1L, "pack", "123123", "110101199001014294") ;
        return user  ;
    }

    @GetMapping("/user/nopassword")
    @JsonView(UserView.WithoutPassword.class)
    public User userNoPassword() {
        User user = new User(1L, "pack", "123123", "110101199001014294") ;
        return user  ;
    }

    @GetMapping("/user/full")
    @JsonView(UserView.Full.class)
    public User user() {
        User user = new User(1L, "pack", "123123", "110101199001014294") ;
        return user  ;
    }
}